<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      template="./template/UserTemplate.xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:c="http://java.sun.com/jsp/jstl/core"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:p="http://primefaces.prime.com.tr/ui">

    <body>

        <ui:composition template="./template/UserTemplate.xhtml">

            <ui:define name="main_content">
                <h1 class="heading colr">Insert Student</h1>
                
                <h:form prependId="false" styleClass="form panel" id="form">
                    <p:fieldset>
                        <dl>
                            <dt></dt>
                            <dd><label>Student Roll No:</label><p:inputText value="#{studentManagedBean.studentRollNo}" /></dd>
                            <dd><label>Student name:</label><p:inputText value="#{studentManagedBean.studentName}" /></dd>
                            <dt></dt>
                            <dd><label>Birthday:</label><p:calendar value="#{studentManagedBean.birthDay}" pattern="dd/MM/yyyy" /></dd>
                            <dt></dt>
                            <dd><label>Gender</label>
                                <h:selectOneRadio value="#{studentManagedBean.gender}">
                                    <f:selectItem itemLabel="Male" itemValue="True" ></f:selectItem>
                                    <f:selectItem itemLabel="Female" itemValue="False"></f:selectItem>
                                </h:selectOneRadio>
                            </dd>
                            <dt></dt>
                            <dd><label>Phone No</label><p:inputText value="#{studentManagedBean.phoneNo}"/></dd>
                            <dt></dt>
                            <dd><label>Email</label><p:inputText value="#{studentManagedBean.email}"/></dd>
                            <dt></dt>
                            <dd><label>Address</label><p:inputTextarea value="#{studentManagedBean.address}"/></dd>

                            <dd><label>Curriculum</label>
                                <h:selectOneMenu style="width: 120px;" value="#{curriculumManagedBean.curriculumId}" title="Select Curriculum">
                                    <c:forEach var="curriculum" items="${curriculumManagedBean.all}" >
                                        <f:selectItem itemLabel="${curriculumManagedBean.curriculumName}" itemValue="${curriculum.curriculumId}" />
                                    </c:forEach>
                                </h:selectOneMenu>
                            </dd>

                            <dd><label>Semster</label>
                                <h:selectOneMenu style="width: 120px;" value="#{semesterManagedBean.semesterId}" title="Select Curriculum">
                                    <c:forEach var="semester" items="${semesterManagedBean.all}" >
                                        <f:selectItem itemLabel="${semesterManagedBean.semesterName}" itemValue="${class.semesterId}" />
                                    </c:forEach>
                                </h:selectOneMenu>
                            </dd>
                            <dd><label>Class</label>
                                <h:selectOneMenu style="width: 120px;" value="#{classManagedBean.classId}" title="Select Curriculum">
                                    <c:forEach var="class" items="${classManagedBean.all}" >
                                        <f:selectItem itemLabel="${classManagedBean.className}" itemValue="${class.classId}" />
                                    </c:forEach>
                                </h:selectOneMenu>
                            </dd>
                        </dl>

                        <hr/>
                        <h:commandButton styleClass="button button-blue" style="margin-right: 7px" value="Submit" action="#{branchManagedBean.add}" />

                        <h:commandButton styleClass="button button-gray" value="Cancel" type="reset"/>
                    </p:fieldset>
                </h:form>
            </ui:define>

        </ui:composition>

    </body>
</html>
